package com.jeesite.modules.financing.service.finserviceorder;

import com.jeesite.modules.custom.enumInfo.BillStatusEnum;
import com.jeesite.modules.financial.entity.billnegotiated.BillNegotiated;
import com.jeesite.modules.financial.entity.incomeexpenditure.IncomeExpenditure;
import com.jeesite.modules.financial.entity.taxclearance.TaxClearance;
import com.jeesite.modules.financial.entity.ttpaymentorder.TtPaymentOrder;
import com.jeesite.modules.financial.service.billnegotiated.BillNegotiatedService;
import com.jeesite.modules.financial.service.incomeexpenditure.IncomeExpenditureService;
import com.jeesite.modules.financial.service.taxclearance.TaxClearanceService;
import com.jeesite.modules.financial.service.ttpaymentorder.TtPaymentOrderService;
import com.jeesite.modules.financing.entity.finserviceorder.FinServiceOrder;
import com.jeesite.modules.order.entity.serviceorder.ServiceOrder;
import com.jeesite.modules.order.service.serviceorder.ServiceOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class YYService {
    @Autowired
    private BillNegotiatedService billNegotiatedService;
    @Autowired
    private ServiceOrderService serviceOrderService;
    @Autowired
    private TtPaymentOrderService ttPaymentOrderService;
    @Autowired
    private FinServiceOrderService finServiceOrderService;
    @Autowired
    private TaxClearanceService taxClearanceService;
    @Autowired
    private IncomeExpenditureService incomeExpenditureService;
    /**
     * 根据前置单据类型，和单据id查询单据编号
     * @param parentBillType 前置单据类型
     * @param parentBillCode 前置单据编号
     * @return 单据编号
     */
    public String getBillCodeById(String parentBillType,String parentBillCode){
        BillStatusEnum billStatusEnum = BillStatusEnum.valueOf(parentBillType);
        String code="";
        switch(billStatusEnum.getDay()){
            case "服务订单":
                ServiceOrder serviceOrder = serviceOrderService.get(parentBillCode);
                code=serviceOrder.getServiceOrderCode();
                break; //可选
            case "到单押汇" :
                BillNegotiated billNegotiated = billNegotiatedService.get(parentBillCode);
                code=billNegotiated.getBillNegotiatedCode();
                break;
            case "tt付款单" :
                TtPaymentOrder ttPaymentOrder = ttPaymentOrderService.get(parentBillCode);
                code=ttPaymentOrder.getPaymentOrderCode();
                break;
            case "融资服务订单" :
                FinServiceOrder finServiceOrder = finServiceOrderService.get(parentBillCode);
                code=finServiceOrder.getFinancingServiceOrderCode();
                break;
            case "通关缴税" :
                TaxClearance taxClearance = taxClearanceService.get(parentBillCode);
                code=taxClearance.getTaxClearanceCode();
                break;
            case "收支明细" :
                IncomeExpenditure incomeExpenditure = incomeExpenditureService.get(parentBillCode);
                code=incomeExpenditure.getIncomeExpenditureCode();
                break;
            case "信用证" :

                break;
            case "空的前置单据" :
                break;
            default :
                code="未知单据类型";
        }
        return code;
    }

}
